#include <iostream>
using namespace std;

signed main()
{
    char c;
    string s;
    cin>>c;
    getline(cin,s);
    getline(cin,s);
    if(c=='C'){
        s.append(1,'-');
        int num = 1;
        for(int i=1;i<s.size();i++){
            if(s[i]==s[i-1]){
                num++;
            }
            else{
                if(num==1)    cout<<s[i-1];
                else    cout<<num<<s[i-1];
                num = 1;
            }
        }
    }
    else{
        for(int i=0;i<s.size();i++){
            int num = 0;
            while(s[i]>='0'&&s[i]<='9'){
                num = num*10+s[i]-'0';
                i++;
            }
            for(int j=0;j<num;j++)    cout<<s[i];
            if(!num)    cout<<s[i];
        }
    }
    return 0;
}
